package main

import (
	"fmt"
)

func solution(array []int) int {
	freq := make(map[int]int)
	for _, num := range array {
		freq[num]++
	}

	for key, _ := range freq {
		if freq[key] > len(array)/2 {
			return key
		}
	}
	return 0
}

func main() {
	fmt.Println(solution([]int{1, 3, 8, 2, 3, 1, 3, 3, 3}) == 3)
}